<?xml version="1.0" encoding="UTF-8"?>
<!-- 
on linux:
curl -sL "https://www.googleapis.com/shopping/search/v1/cx:YOUR_CX/products?
  country=us&alt=atom&prettyprint=true&key=YOUR_KEY-U&q=android" | 
  xsltproc 
  http://gcs-admin-toolkit.googlecode.com/svn/trunk/src/xslt/searchAPI.xslt -
 -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
				xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
				xmlns:atom="http://www.w3.org/2005/Atom"
				xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
				xmlns:g="http://base.google.com/ns/1.0"
				xmlns:gd="http://schemas.google.com/g/2005" 
				xmlns:s="http://www.google.com/shopping/api/schemas/2010" 
				version="2.0"	    
 			    >
 			    
 <xsl:output method="html"  omit-xml-declaration="yes"  />

 <xsl:template match="/" >
 <html xsl:exclude-result-prefixes="xsl soapenv atom openSearch g s">
 
 <head>
 	<title>
 		Google SearchAPI for Shopping Transform Example
 	</title>
 </head>
		<body>
		<strong>Title:</strong> <xsl:value-of select="/atom:feed/atom:title"/><br/>
 		<strong>Query:</strong> <font size="1">
 				<xsl:for-each select="/atom:feed/atom:link">
				<xsl:if test="@rel[.='self']">
				    <xsl:value-of  select="@href"/>
				</xsl:if> 					
 			   </xsl:for-each>
 			   </font>
		<br/>		
		<strong>Matches:</strong> <xsl:value-of select="/atom:feed/openSearch:totalResults"/> Items
		<br/>
		
			<xsl:if test="/atom:feed/s:spelling/s:suggestion">
			   Spell Suggestion: Did you Mean 
			        <xsl:value-of  select="/atom:feed/s:spelling/s:suggestion"/>?
			   <br/>
			</xsl:if>
		
		<xsl:for-each select="/atom:feed/s:promotions/s:promotion">
		   Promotion:
		   			<img>
		   				<xsl:attribute name="src">
		   					<xsl:value-of  select="@imageLink"/>
		   				</xsl:attribute>
		   			</img>
		   			<br/>
		   			<a>
		   			  <xsl:attribute name="href">
		   			    <xsl:value-of  select="@link"/>
		   			  </xsl:attribute>
			        <xsl:value-of select="@name"/>
			        </a>
			   <br/>
		</xsl:for-each>		
		
		<p>
		<table border="1">		
			<tr>
			<td valign="top" width="200px">
				<h3>Facets</h3>					
					<xsl:for-each select="/atom:feed/s:facets/s:facet">
					
					   <xsl:if test="@property[.!='']">
							<xsl:value-of  select="@property"/> <br/>
					   </xsl:if>
					   <xsl:if test="@name[.!='']">
							<xsl:value-of  select="@name"/> <br/>
					   </xsl:if>						
						
						<xsl:for-each select="s:bucket">
						<xsl:choose>
						   <xsl:when test="@value[.!='']">
							<font size="1">
								<xsl:value-of  select="@value"/>: (<xsl:value-of  select="@count"/>)<br/>
							</font>
						   </xsl:when>
						   <xsl:otherwise>
							<font size="1">
								<xsl:value-of  select="@min"/>.. <xsl:value-of  select="@max"/>: (<xsl:value-of  select="@count"/>)<br/>
							</font>
						   </xsl:otherwise>						
						</xsl:choose>
						</xsl:for-each>
						<br/>
					</xsl:for-each>
			</td>
				<td valign="top">
				<h3>Results</h3>
					<table>
					<xsl:for-each select="/atom:feed/atom:entry">
					<tr>	
						<td>
							<img>
								<xsl:attribute name="src">
									<xsl:value-of select="s:product/s:images/s:image/@link"/>
								</xsl:attribute>
							</img>
						</td>
						<td>
							 <xsl:if test="atom:link/@rel='alternate'">
								 <a>
								   <xsl:attribute name="href">	
								     <xsl:apply-templates select="atom:link"/> 	 
								   </xsl:attribute>
								 <xsl:value-of  select="atom:title"/>
								 </a>			 
							 </xsl:if>
						     <xsl:value-of select="atom:content"/>
						    <br/>
			   		        GoogleID: <xsl:value-of select="s:product/s:googleId"/>
						    <br/>
						    ProviderID: <xsl:value-of select="s:product/s:providedId"/>
						    <br/>
						    Price: <xsl:value-of select="s:product/s:inventories/s:inventory/s:price"/>
						    <br/>
						</td>
					</tr>
					</xsl:for-each>
					</table>
				</td>
			</tr>
			</table>
		</p>
		
		</body>
</html>
</xsl:template>
 
</xsl:stylesheet>